package com.tanhua.server.server;


import com.tanhua.dubbo.api.UserApi;
import com.tanhua.model.domian.User;
import com.tanhua.model.vo.HuanXinUserVo;
import com.tanhua.server.interceptor.UserHolder;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class HuanXinService {


    @DubboReference
    private UserApi userApi;

    public HuanXinUserVo findHuanXinUser() {
        Long userId = UserHolder.getUserId();
       User user =  userApi.findById(userId);
       if (user != null){
           return new HuanXinUserVo(user.getHxUser(),user.getHxPassword());
       }
       return null;
    }
}
